var _editor_url = "/Script/htmlarea/";                     // URL to htmlarea files


var config = new Object();    // create new config object

config.width = "90%";
config.height = "200px";
config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
config.debug = 0;

// NOTE:  You can remove any of these blocks and use the default config!

config.toolbar = [		
	['bold','italic','underline','separator'],
	['strikethrough','subscript','superscript','separator'],
	['justifyleft','justifycenter','justifyright','separator'],
	['OrderedList','UnOrderedList','Outdent','Indent','separator'],
	['forecolor','backcolor','separator'],
	['htmlmode','separator'],	
];

config.fontnames = {
	"Arial":           "arial, helvetica, sans-serif",
	"Courier New":     "courier new, courier, mono",
	"Georgia":         "Georgia, Times New Roman, Times, Serif",
	"Tahoma":          "Tahoma, Arial, Helvetica, sans-serif",
	"Times New Roman": "times new roman, times, serif",
	"Verdana":         "Verdana, Arial, Helvetica, sans-serif",
	"impact":          "impact",
	"WingDings":       "WingDings"
};
config.fontsizes = {
	"1 (8 pt)":  "1",
	"2 (10 pt)": "2",
	"3 (12 pt)": "3",
	"4 (14 pt)": "4",
	"5 (18 pt)": "5",
	"6 (24 pt)": "6",
	"7 (36 pt)": "7"
};

//config.stylesheet = "http://www.domain.com/sample.css";
	
config.fontstyles = [   // make sure classNames are defined in the page the content is being display as well in or they won't work!
{ name: "headline",     className: "headline",  classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
{ name: "arial red",    className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
{ name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }

// leave classStyle blank if it's defined in config.stylesheet (above), like this:
//  { name: "verdana blue", className: "headline4", classStyle: "" }  
];

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) 
{    
    include_js(_editor_url + 'editor.js')
}

function include_js(file) {
    //Script found on this page : http://www.phpied.com/javascript-include-ready/
    var html_doc = document.getElementsByTagName('head').item(0);
    js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', file);
    html_doc.appendChild(js);

    // alert state change
    js.onreadystatechange = function () {
        //alert(js.readyState);

        if (js.readyState == 'complete' || js.readyState == 'loaded' ) {
            // safe to call a function
            // found in the new script
            editor_generate('%fieldname%',config);
        }
    }
    return false;
}



